package com.medisched.medisched.controller;

import com.medisched.medisched.domain.Leaveapplication;
import com.medisched.medisched.service.ILeaveapplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 请假记录Controller
 * 
 * @author ruoyi
 * @date 2025-05-15
 */
@CrossOrigin
@RestController
@RequestMapping("/system/leaveapplication")
public class LeaveapplicationController
{
    @Autowired
    private ILeaveapplicationService leaveapplicationService;

    /**
     * 查询请假记录列表
     */
    @GetMapping("/list")
    public List<Leaveapplication>  list(Leaveapplication leaveapplication)
    {
        return leaveapplicationService.selectLeaveapplicationList(leaveapplication);
    }

    /**
     * 获取请假记录详细信息
     */
    @GetMapping(value = "/{id}")
    public Leaveapplication getInfo(@PathVariable("id") Long id)
    {
        return leaveapplicationService.selectLeaveapplicationById(id);
    }

    /**
     * 新增请假记录
     */
    @PostMapping
    public int add(@RequestBody Leaveapplication leaveapplication)
    {
        return leaveapplicationService.insertLeaveapplication(leaveapplication);
    }

    /**
     * 修改请假记录
     */
    @PutMapping
    public int edit(@RequestBody Leaveapplication leaveapplication)
    {
        return leaveapplicationService.updateLeaveapplication(leaveapplication);
    }

    /**
     * 删除请假记录
     */
	@DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return leaveapplicationService.deleteLeaveapplicationByIds(ids);
    }
}
